home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgramD2.iso
/
Borland
/
Borland C++ V5.02
/
ODBCINF.PAK
/
CATSETS.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1997-05-06
|
3KB
|
109 lines
// catsets.cpp
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) 1992-1996 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
#include "stdafx.h"
#include "catsets.h"
//---------------------------------------------------------------------
// CGetTypeInfo
CGetTypeInfo::CGetTypeInfo(CDatabase* pDatabase)
: CRecordset(pDatabase)
{
m_strTypeName = _T("");
m_fDataType = 0;
m_nPrecision = 0;
m_strLiteralPrefix = _T("");
m_strLiteralSuffix = _T("");
m_strCreateParams = _T("");
m_fNullable = 0;
m_bCaseSensitive = 0;
m_fSearchable = 0;
m_fUnsignedAttribute = 0;
m_bMoney = 0;
m_fAutoIncrement = 0;
m_strLocalTypeName = _T("");
m_nMinimumScale = 0;
m_nMaximumScale = 0;
m_nFields = 15;
}
BOOL CGetTypeInfo::Open(short fSqlType,
UINT nOpenType)
{
RETCODE nRetCode;
UWORD bFunctionExists;
// make suer SQLGetTypeInfo exists
AFX_SQL_SYNC(::SQLGetFunctions(m_pDatabase->m_hdbc,
SQL_API_SQLGETTYPEINFO,&bFunctionExists));
if (!Check(nRetCode) || !bFunctionExists)
{
if (!bFunctionExists)
TRACE(_T("SQLGetTypeInfo not supported\n"));
return FALSE;
}
m_nOpenType = nOpenType;
m_bUpdatable = FALSE;
// make sure hstmt is allocated
if (m_hstmt == SQL_NULL_HSTMT)
{
AFX_SQL_SYNC(::SQLAllocStmt(m_pDatabase->m_hdbc,&m_hstmt));
if (!Check(nRetCode))
ThrowDBException(nRetCode,m_hstmt);
}
OnSetOptions(m_hstmt);
// call the ODBC function
AFX_SQL_ASYNC(this,::SQLGetTypeInfo(m_hstmt,fSqlType));
if (!Check(nRetCode))
ThrowDBException(nRetCode,m_hstmt);
TRY
{
MoveFirst();
}
CATCH_ALL(e)
{
Close();
THROW_LAST();
}
END_CATCH_ALL
return TRUE;
}
void CGetTypeInfo::DoFieldExchange(CFieldExchange* pFX)
{
pFX->SetFieldType(CFieldExchange::outputColumn);
RFX_Text(pFX,_T("TYPE_NAME"),m_strTypeName);
RFX_Int(pFX,_T("DATA_TYPE"),m_fDataType);
RFX_Long(pFX,_T("PRECISION"),m_nPrecision);
RFX_Text(pFX,_T("LITERAL_PREFIX"),m_strLiteralPrefix);
RFX_Text(pFX,_T("LITERAL_SUFFIX"),m_strLiteralSuffix);
RFX_Text(pFX,_T("CREATE_PARAMS"),m_strCreateParams);
RFX_Int(pFX,_T("NULLABLE"),m_fNullable);
RFX_Bool(pFX,_T("CASE_SENSITIVE"),m_bCaseSensitive);
RFX_Int(pFX,_T("SEARCHABLE"),m_fSearchable);
RFX_Int(pFX,_T("UNSIGNED_ATTRIBUTE"),m_fUnsignedAttribute);
RFX_Bool(pFX,_T("MONEY"),m_bMoney);
RFX_Int(pFX,_T("AUTO_INCREMENT"),m_fAutoIncrement);
RFX_Text(pFX,_T("LOCAL_TYPE_NAME"),m_strLocalTypeName);
RFX_Int(pFX,_T("MINIMUM_SCALE"),m_nMinimumScale);
RFX_Int(pFX,_T("MAXIMUM_SCALE"),m_nMaximumScale);
}